package operator

import (
	"fmt"
	"math"
)

var a bool = true

func Load() {

}

func init() {
	main()
}

func main() {
	fmt.Println(a)
	fmt.Println(!a)

	var c int
	var d int32

	d = int32(c) + int32(c)
	fmt.Println(d)
	d = d + 5
	fmt.Printf("%d, %x\n", d, &d)

	fmt.Println(math.MaxUint8)
	fmt.Println(math.MinInt8)
	fmt.Println(math.MaxInt8)

	fmt.Println(Uint8FromInt(90))
}

func Uint8FromInt(n int) (uint8, error) {
	if n >= 0 && n <= math.MaxUint8 {
		return uint8(n), nil
	} else {
		return 0, fmt.Errorf("%d is out of the uint8 range", n)
	}
}


func intFromFloat64(x float64) (int, error) {
	if x >= math.MinInt32 && x <= math.MaxInt32 {
		whole, fraction := math.Modf(x)
		if fraction >= 0.5 {
			whole++
		}
		//return int(whole)
	}

	return 0, nil
}
